package com.jwcao.common.cast.demo;

import cn.hutool.json.JSONUtil;
import com.jwcao.common.cast.annotation.CastField;
import com.jwcao.common.cast.annotation.CastGet;
import com.jwcao.common.cast.annotation.CastObject;
import com.jwcao.common.cast.annotation.CastToCallBack;
import com.jwcao.common.cast.demo.impl.AbstractA;
import com.jwcao.common.cast.demo.impl.BaseA;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.Singular;

/**
 * name: A description: TODO
 *
 * @author caojingwei date: 2023/3/25 15:43
 */
@CastObject(className = "com.jwcao.common.cast.demo.B", id = "test")
@Builder
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class A {

    private String id;
    private String name;
    private String value;
    @Singular("oneList")
    private List<AItem1> list;
    @CastField(id = "test", value = "b1")
    private String a1;
    @Singular("oneAList")
    @CastField(id = "test", value = "bList")
    private List<BaseA> aList;
    @CastField(id = "test", value = "baseB")
    private BaseA baseA;

    private boolean aBoolean;
    @CastGet(id = "test")
    public String bGetter() {
        return "bGetter";
    }

    @CastToCallBack(id = "test")
    public void CastCallBack(B b) {
        System.out.println("A->B" + JSONUtil.toJsonStr(b));
    }
    private AbstractA abstractObject;

}
